import glumpy
from gl_shapes import *

fig = glumpy.figure( (800,800) )
smooth()

#here I can create some variables that are shared among my funtions (on_draw and timer)
x_pos = 0

@fig.event
def on_draw():
    #this is where we draw the things of our scene
    fig.clear()
    start = (x_pos,200)
    end = (x_pos,600)
    points = (start,end)
    polyline(points, color=(0.0,0.0,0.0,.9), stroke=1.0)

@fig.timer(1) # frames per second
def timer(elapsed):
    # print 'Timed event (%.2f second(s) elapsed)' % elapsed
    # "global" tells python to use the variable I have prevously declared instead of make a new local one
    global x_pos
    x_pos += 10
    #tell python to redraw the figure
    fig.redraw()

glumpy.show()